home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / lisp / eulisp / feel0_89.lha / Feel / Libs / CSP / loopsII.em < prev    next >
Encoding:
Text File  |  1993-07-18  |  927 b   |  35 lines

  1. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2. ;;                                                                           ;;
  3. ;;  EuLisp Module                     Copyright (C) University of Bath 1991  ;;
  4. ;;                                                                           ;;
  5. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  6.  
  7. (defmodule loopsII
  8.  
  9.   (standard0) ()
  10.   ;;( lists list-operators macros0 others)
  11.  
  12.   ()
  13.   
  14.   (defun map-while (ff pf)
  15.     (when (pf) (ff) (map-while ff pf)))
  16.  
  17.   (defmacro while (pred . forms)
  18.     `(let/cc @continue-cont@
  19.        (let/cc @break-cont@
  20.          (map-while (lambda () (progn ,@forms)) (lambda () ,pred)))))
  21.  
  22. ;;   (defmacro for (init test iter . body)
  23. ;;     `(progn
  24. ;;        ,init
  25. ;;        (while ,test
  26. ;;      ,@body
  27. ;;      ,iter)))
  28.  
  29.   (defmacro ++ (var)
  30.     `(setq ,var (+ ,var 1)))
  31.  
  32.   (export map-while while ++)
  33.  
  34. )
  35.